// Copyright(c) 2011 Matthew McMullan, Jorel Lalicki and Mike Heise, Jorel Lalicki and Mike Heise. See copying.txt for details.

#ifndef __agml_arch_h__
#define __agml_arch_h__

// make sure that this file is never included directly
#ifndef __agml_agml_h__
#error "Include AGML from agml.h only. This file is not a valid entry point for the library."
#endif

// detect bit width
#if defined __amd64__ || __amd64 || __x86_64__ || __x86_64 || _M_X64 || __ia64__ || _IA64 || __IA64__ || _M_IA64 || _M_IA64 || __ia64
#define __agml_64_bit
#else
#define __agml_32_bit
#endif

// detect architecture
#if defined __amd64__ || __amd64 || __x86_64__ || __x86_64 || _M_X64 || __ia64__ ||  _IA64 || __IA64__ || __ia64 || _M_IA64
#define __agml_arch_x86
#define __agml_arch_x86_64
#elif defined i386 || __i386__ || __i386 || _M_IX86 || __X86__ || _X86_ || __I86__
#define __agml_arch_x86
#define __agml_arch_x86_32
#elif defined __arm__ || __thumb__ || __TARGET_ARCH_ARM || __TARGET_ARCH_THUMB || _ARM
#define __agml_arch_arm
#else
#define __agml_arch_other
#warning "Using unsupported architecture. Proceed at your own risk."
#endif

// architecture specific stuff
#ifdef __agml_arch_x86_64
#include "x86-64/x86-64.h"
#elif defined __agml_arch_x86_32
#include "x86/x86.h"
#elif defined __agml_arch_arm
#include "arm/arm.h"
#else
#include "generic/generic.h"
#endif

#endif
